-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed exception on linear_quantize_activations for ImageType output #2385
base: main
Are you sure you want to change the base?
Conversation
output_value may be a PIL image, in which case convert it to numpy array so that the following calculations can still be run
Thanks for the fix. Can you add a unit test that fails without this fix, but passes with this fix? |
Hi @TobyRoseman I've just discovered that the root cause of this issue is the function coremltools/coremltools/optimize/coreml/experimental/_model_debugger.py Lines 369 to 372 in 68b4f5a
Hence, I believe rather than changing What do you think? |
Thanks @Zerui18 for looking into this. I'm not very familiar with that part of the code. I think @yixingli-apple or @junpeiz should be able to help here. |
Hi, is there any updates on this? |
Hi @Zerui18 , I agree with you we should make a fix in We just released coremltools 8.1, and the part of code have been changed. Can you please rebase and create a PR based on that? |
Hi @yixingli-apple , I've created a new PR #2405 based on your suggestion. |
Issue
Calling
cto.coreml.experimental.linear_quantize_activations
on a model withct.ImageType
output(s) fails at the model output becausecheck_intermediate_output
expectsoutput_value
to be anp.ndarray
but the model's final output isPIL.Image
.Solution
This patch adds a simple attempt to convert the
output_value
tonp.ndarray
before the computations.